import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;


import org.junit.Test;
import junit.framework.TestCase;
public class ComplexTest extends TestCase {
    Complex c1 = new Complex(1, 1);
    Complex c2 = new Complex(-1, -1);
    Complex c3 = new Complex(-1,1);
    @Test
    public void testgetRealPart() throws Exception {
        assertEquals(2.0, Complex.getRealPart(2.0));
        assertEquals(-2.0, Complex.getRealPart(-2.0));
        assertEquals(0.0, Complex.getRealPart(0.0));
    }
    @Test
    public void testgetImagePart() throws Exception {
        assertEquals(-1.0, Complex.getImagePart(-1.0));
        assertEquals(1.0, Complex.getImagePart(1.0));
        assertEquals(0.0, Complex.getImagePart(0.0));
    }
    @Test
    public void testComplexAdd() throws Exception {
        assertEquals("0.0", c1.Add(c2).toString());
        assertEquals("0.0+2.0i", c1.Add(c3).toString());
        assertEquals("-2.0", c2.Add(c3).toString());
    }
    @Test
    public void testComplexSub() throws Exception {
        assertEquals("2.0+2.0i", c1.Sub(c2).toString());
        assertEquals("2.0", c1.Sub(c3).toString());
        assertEquals("0.0 -2.0i", c2.Sub(c3).toString());
    }
    @Test
    public void testComplexMulti() throws Exception {
        assertEquals("0.0 -2.0i", c1.Multi(c2).toString());
        assertEquals("-2.0", c1.Multi(c3).toString());
        assertEquals("2.0", c2.Multi(c3).toString());
    }
    @Test
    public void testComplexComplexDiv() throws Exception {
        assertEquals("-1.0 -1.0i", c1.Div(c2).toString());
        assertEquals("0.0", c1.Div(c3).toString());
        assertEquals("0.0", c2.Div(c3).toString());
    }
}
